using MicroMsg.Resource.@string;
using MicroMsg.UI.Page;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace MicroMsg.UI.UserContrl
{
	public class MassMsgItemTitle : UserControl
	{
		private bool isTextExpand;
		public static DependencyProperty listCountProperty = DependencyProperty.Register("listCount", typeof(string), typeof(MassMsgItemTitle), new PropertyMetadata(null, new PropertyChangedCallback(MassMsgItemTitle.OnlistCountChanged)));
		public static DependencyProperty listNamesProperty = DependencyProperty.Register("listNames", typeof(string), typeof(MassMsgItemTitle), new PropertyMetadata(null, new PropertyChangedCallback(MassMsgItemTitle.OnlistNamesChanged)));
		internal StackPanel Container;
		internal StackPanel mainContent;
		internal TextBlock NumTxt;
		internal TextBlock NumIntrTxt;
		internal Image ArrowImg;
		internal RotateTransform imgRotateTransform;
		internal EmojiText ConNameList;
		internal EmojiTextEx ConNameListEx;
		private bool _contentLoaded;
		public string listCount
		{
			get
			{
				return (string)base.GetValue(MassMsgItemTitle.listCountProperty);
			}
			set
			{
				base.SetValue(MassMsgItemTitle.listCountProperty, value);
			}
		}
		public string listNames
		{
			get
			{
				return (string)base.GetValue(MassMsgItemTitle.listNamesProperty);
			}
			set
			{
				base.SetValue(MassMsgItemTitle.listNamesProperty, value);
			}
		}
		public MassMsgItemTitle()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.MassMsgItemTitle_Loaded));
			base.add_Unloaded(new RoutedEventHandler(this.MassMsgItemTitle_Unloaded));
			this.InitBindResource();
		}
		private void InitBindResource()
		{
			this.mainContent.set_Background(R.theme.PLUGIN_MASSSEND_VIEWTITLE_BK_BRUSH);
			this.NumTxt.set_Foreground(R.theme.COMMON_BRUSH);
			this.NumIntrTxt.set_Foreground(R.theme.PLUGIN_MASSSEND_SENDCTRL_TITLE_FOREGROUND_BRUSH);
			this.NumIntrTxt.set_Text(strings.MassSend_ReadMessage_Receiver);
			this.ConNameList.Foreground = R.theme.PLUGIN_MASSSEND_SENDCTRL_TITLE_FOREGROUND_BRUSH;
			this.ConNameListEx.set_Foreground(R.theme.PLUGIN_MASSSEND_SENDCTRL_TITLE_FOREGROUND_BRUSH);
		}
		private void MassMsgItemTitle_Loaded(object sender, RoutedEventArgs e)
		{
			this.isTextExpand = false;
			if (this.ConNameList.IsTextTooLong)
			{
				this.ArrowImg.set_Visibility(0);
			}
		}
		private void MassMsgItemTitle_Unloaded(object sender, RoutedEventArgs e)
		{
		}
		private void ArrowTrans()
		{
			Storyboard rotateStoryBoard;
			if (!this.isTextExpand)
			{
				rotateStoryBoard = this.getRotateStoryBoard(0.0, 90.0);
				rotateStoryBoard.Begin();
				this.isTextExpand = true;
				this.ConNameList.set_Visibility(1);
				this.ConNameListEx.set_Visibility(0);
				return;
			}
			rotateStoryBoard = this.getRotateStoryBoard(90.0, 0.0);
			rotateStoryBoard.Begin();
			this.isTextExpand = false;
			this.ConNameList.set_Visibility(0);
			this.ConNameListEx.set_Visibility(1);
		}
		private void ArrowImg_Tap(object sender, GestureEventArgs e)
		{
			this.ArrowTrans();
		}
		private Storyboard getRotateStoryBoard(double from, double double_0)
		{
			TimeSpan timeSpan = TimeSpan.FromSeconds(0.1);
			Storyboard storyboard = new Storyboard();
			DoubleAnimation doubleAnimation = new DoubleAnimation();
			doubleAnimation.set_From(new double?(from));
			doubleAnimation.set_To(new double?(double_0));
			doubleAnimation.set_Duration(timeSpan);
			DoubleAnimation doubleAnimation2 = doubleAnimation;
			Storyboard.SetTarget(doubleAnimation2, this.imgRotateTransform);
			Storyboard.SetTargetProperty(doubleAnimation2, new PropertyPath(RotateTransform.AngleProperty));
			storyboard.get_Children().Add(doubleAnimation2);
			return storyboard;
		}
		private static void OnlistCountChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == MassMsgItemTitle.listCountProperty)
			{
				MassMsgItemTitle massMsgItemTitle = dependencyObject_0 as MassMsgItemTitle;
				massMsgItemTitle.NumTxt.set_Text(massMsgItemTitle.listCount);
			}
		}
		private static void OnlistNamesChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == MassMsgItemTitle.listNamesProperty)
			{
				MassMsgItemTitle massMsgItemTitle = dependencyObject_0 as MassMsgItemTitle;
				massMsgItemTitle.ConNameList.Text = massMsgItemTitle.listNames;
				massMsgItemTitle.ConNameListEx.Text = massMsgItemTitle.listNames;
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/MassSend/UI/MassMsgItemTitle.xaml", 2));
			this.Container = (StackPanel)base.FindName("Container");
			this.mainContent = (StackPanel)base.FindName("mainContent");
			this.NumTxt = (TextBlock)base.FindName("NumTxt");
			this.NumIntrTxt = (TextBlock)base.FindName("NumIntrTxt");
			this.ArrowImg = (Image)base.FindName("ArrowImg");
			this.imgRotateTransform = (RotateTransform)base.FindName("imgRotateTransform");
			this.ConNameList = (EmojiText)base.FindName("ConNameList");
			this.ConNameListEx = (EmojiTextEx)base.FindName("ConNameListEx");
		}
	}
}
